package homework;

import java.util.Random;

public class Homework11 {
	public static void main(String[] args) {
		//石头2、剪刀1、布0  (if else if ) 
		Random rand = new Random();
		
		int player1 = rand.nextInt(3);  // 0-2
		int player2 = rand.nextInt(3);  // 0-2
		
		System.out.println("player1:" + (player1 == 0 ? '布' : (player1 == 1 ? "剪刀" : "石头")));
		System.out.println("player2:" + (player2 == 0 ? '布' : (player2 == 1 ? "剪刀" : "石头")));
		
		if (player1 == player2) {
			System.out.println("平手");
		}else if (player1 - player2 == 1 || player1 - player2 == -2) {
			System.out.println("player1 win");
		} else {
			System.out.println("player2 win");
		}
		
	}
}
